<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/3
 * Time: 12:21
 */

namespace Admin\Controller;
use Admin\Controller\AdminController;
use Admin\Model\ApplicationModel;

class ApplicationController extends AdminController
{
    //查询所有申请记录$this->checkPower();
    public function index ()
    {
        $this->checkPower();
        $name = "";
        if(!empty($_GET['name'])){
            $name = I("get.name");
        }
        $time= "";
        if(!empty($_GET['time'])){
            $time = I("get.time");
        }
        $status = "";
        if(!empty($_GET['status'])){
            $status = I("get.status");
        }
        $data['name'] = $name;
        $data['time'] = $time;
        $data['status'] = $status;

        //排序字段
        $order = "";
        if(!empty($_GET['order'])){
            $order = I("get.order");
        }
        //排序方式
        $order1 = "";
        if(!empty($_GET['order1'])){
            $order1 = I("get.order1");
        }
        $data['order'] = $order;
        $data['order1'] = $order1;

        $this->title = "组织关系转出记录";
        $applic = new ApplicationModel();
        $res = $applic->queryAllApp($data);
        $this->appList = $res['list'];
        $this->page = $res['show'];
        $this->display("Application/index");
    }

    //根据id查询申请记录详情
    public function queryInfoById()
    {
        $id = I("get.id");
        $app = new ApplicationModel();
        $info = $app ->queryInfoById($id);
        echo json_encode($info);
    }
}